home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11594 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  39 lines

  1. Newsgroups: comp.lang.c++
  2. Path: netcom.com!sergeboj
  3. From: sergeboj@netcom.com (Serge Bojoulitch)
  4. Subject: Re: TYPEDEF help needed
  5. Message-ID: <sergebojDoAr89.1yB@netcom.com>
  6. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  7. X-Newsreader: TIN [version 1.2 PL1]
  8. References: <Do9J5n.KE7.0.-s@cs.vu.nl> <4ianrs$m0f@B1FF.mindspring.com>
  9. Date: Fri, 15 Mar 1996 06:55:21 GMT
  10. Sender: sergeboj@netcom11.netcom.com
  11.  
  12. Justin Rudd (rudd@mindspring.com) wrote:
  13. : >typedef struct Coordinates
  14. : >{
  15. : >    int x,y;
  16.  
  17. : >} Coordinates;
  18.  
  19. : Try this....
  20.  
  21. : typedef struct _Coordinates
  22. : {
  23. :     int x,y;
  24. : } Coordinates;
  25.  
  26. : The reason it probably wasn't working is because the name of the
  27. : struct and the variable were the same...it is on the same concept of
  28. : this:  int int.  You can't declare an int with the name int.
  29.  
  30. Excuse me, IMHO having same name for the type and corresponding
  31. structure is perfectly OK with the ANSI C or C++ compiler.  It's
  32. bad style though..., but it has nothing to do with the problem.
  33.  
  34. For the correct answer see posting #2.
  35.  
  36. Best regards,
  37.  
  38. Serge Bojoulitch
  39.